home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
lang
/
shwtxt15
/
mmind.st
< prev
next >
Wrap
Text File
|
1995-02-01
|
2KB
|
57 lines
'MasterMind Game
csr off \ copy (mmind1,1) \ copy (mmind2,2) \ screensaver 3
:restart %won=0 \ %lost=0 \ %total=0
:newgame attr 7 \ cls \ wait .1 \ copy (1,0)255 \ attr 31 \ %rchk=4
gosub update\for %i=1 to 4\v%i=0\next %i
for %i=1 to 4\:agn\v%i=[rnd22to31]
for %j=1 to 4\if %i=%j ok\if v%j=v%i agn\:ok\next %j\next %i\c@13,68
:loop %row=[r.] \ %col=[c.]
peek 0 (%row,%col) %char %attr \ poke 0 (%row,%col) 197 31 \ wait .09
poke 0 (%row,%col) %char %attr \ wait .09 \ waitkey 0,loop
if key esc quit\if key alt c chtmode\if clk(16,5,16,19) restart
if clk(18,5,18,19) rules\if clk(20,5,20,19) quit
if clk(4,24,22,48)undo\if clk(11,61,15,75)pick\if clk(4,50,22,56)check
goto loop
:chtmode bfill 0 (6,64,8,72) 32 31
p@7,64\for %i=1 to 4\attr v%i\!" ";\!char(219);\next\goto loop
:undo if %char<>219 loop\if %row<>%rchk loop
%temp=%col-26\%temp=%temp/6\%temp=%temp*6\%temp=%temp+26
bfill 0 (%rchk,%temp,%rchk,%temp+2) 32 31
for %r=11 to 15 step 2\for %c=61 to 75
peek 0 (%r,%c) attr %temp\if %temp=%attr match\next %c\next %r
:match %temp=%c+2\bfill 0 (%r,%c,%r,%temp) ascii 219\goto loop
:pick if %char<>219 loop\gosub findopen\if %open=0 loop\%open1=%open+2
bfill 0 (%rchk,%open,%rchk,%open1) 219 %attr
%temp=%col
:c1\%temp--\peek 0(%row,%temp) ascii %temp1\if %temp1=219 c1
%temp++\bfill 0 (%row,%temp,%row,%temp+2) ascii 32\goto loop
:check gosub findopen\if %open>0 loop\%rt=0\%ord=0\%c=20
for %i=1 to 4\%c=%c+6\peek 0 (%rchk,%c) attr %temp
for %j=1 to 4\if %temp<>v%j nxt\%rt++\if %i<>%j nxt\%ord++
:nxt\next %j\next %i\p@%rchk,52\attr 31
for %i=1 to %rt\if %i>%ord rt\!char(15);\goto nxti\:rt\!char(254);\:nxti\next %i
poke 0 (%rchk,50) 32 31\bcopy 1 to 0 (11,61,15,75)\if %ord=4 win
if %rchk=22 lose\%rchk=%rchk+2\poke 0 (%rchk,50) 251 31\goto loop
:lose\%lost++\gosub endbox
attr 158\p@17,8\!"YOU LOSE";
attr 31 \p@19,6\!"SEQUENCE WAS:";\p@21,5
for %i=1 to 4\attr v%i\! "███ ";\next %i
waitkey \ goto newgame
:win\%won++\gosub endbox\attr 158\p@18,10\!"Y O U"\p@20,10\!"W I N"
waitkey \ goto newgame
:endbox\%total++\attr 31\window(15,3,23,21)32\window(15,3,23,21)104
:update\p@10,5\print %won,3q\p@10,10\print %lost,3q\p@10,17\print %total,3q\ret
:findopen
for %open=26 to 44 step 6\peek 0 (%rchk,%open) ascii %chkspace
if %chkspace=32 foundone\next %open\%open=0\:foundone\ret
:rules\save\copy (2,0)47\waitkey\restore 47\goto loop
:quit\exitc